home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Complete Linux
/
Complete Linux.iso
/
xwindows
/
demos
/
xfract_1.z
/
xfract_1
/
xfractint-1.06
/
fractint.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-28
|
48KB
|
1,515 lines
/*
FRACTINT - The Ultimate Fractal Generator
Main Routine
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#ifndef XFRACT
#include <dos.h>
#endif
#include <ctype.h>
#include "prototyp.h"
/* routines in this module */
static void cmp_line_cleanup();
static void move_zoombox(int);
static int call_line3d();
static void clear_zoombox();
static void note_zoom();
static void restore_zoom();
static void setup287code();
#define PUTTHEMHERE 1 /* stuff common external arrays here */
#include "fractint.h"
#include "mpmath.h"
#include "fractype.h"
#include "helpdefs.h"
int adapter; /* Video Adapter chosen from list in ...h */
extern int soundflag;
extern char gifmask[];
extern int TPlusErr;
extern int Transparent3D, far NewTPFractal, tpdepth;
extern int AntiAliasing, Shadowing;
extern int pot16bit; /* save 16 bit values for continuous potential */
extern int disk16bit; /* disk video up & running with 16 bit values */
extern int video_type; /* coded value indicating video adapter type */
extern int usr_biomorph;
extern int escape_exit;
extern int forcesymmetry;
extern char readname[]; /* name of fractal input file */
extern int showfile; /* zero if display of file is pending */
#define MAXHISTORY 25 /* save this many historical rcds */
struct historystruct { /* history structure */
int fractype; /* fractal type */
/* double param[2];*/ /* parameters */
double param[4]; /* parameters JCO 6/18/92 */
double xxmin; /* top left */
double yymax; /* top left */
double xxmax; /* bottom right */
double yymin; /* bottom right */
double xx3rd; /* bottom left */
double yy3rd; /* bottom left */
} far *history;
#ifdef __TURBOC__
/* yes, I *know* it's supposed to be compatible with Microsoft C,
but some of the routines need to know if the "C" code
has been compiled with Turbo-C. This flag is a 1 if FRACTINT.C
(and presumably the other routines as well) has been compiled
with Turbo-C. */
int compiled_by_turboc = 1;
/* set size to be used for overlays, a bit bigger than largest (help) */
unsigned _ovrbuffer = 50 * 64; /* that's 50k for overlays, counted in paragraphs */
#else
int compiled_by_turboc = 0;
#endif
extern char savename[]; /* save files using this name */
extern char preview; /* 3D preview mode flag */
extern char temp1[]; /* temporary strings */
extern int debugflag; /* internal use only - you didn't see this */
/*
the following variables are out here only so
that the calcfract() and assembler routines can get at them easily
*/
int active_system = 0; /* 0 for DOS, WINFRAC for Windows */
int dotmode; /* video access method */
int textsafe2; /* textsafe override from videotable */
int oktoprint; /* 0 if printf() won't work */
int sxdots,sydots; /* # of dots on the physical screen */
int sxoffs,syoffs; /* physical top left of logical screen */
int xdots, ydots; /* # of dots on the logical screen */
double dxsize, dysize; /* xdots-1, ydots-1 */
int colors; /* maximum colors available */
int maxit; /* try this many iterations */
int boxcount; /* 0 if no zoom-box yet */
int zrotate; /* zoombox rotation */
double zbx,zby; /* topleft of zoombox */
double zwidth,zdepth,zskew; /* zoombox size & shape */
int fractype; /* if == 0, use Mandelbrot */
char stdcalcmode; /* '1', '2', 'g', 'b' */
long creal, cimag; /* real, imag'ry parts of C */
long delx, dely; /* screen pixel increments */
long delx2, dely2; /* screen pixel increments */
double delxx, delyy; /* screen pixel increments */
double delxx2, delyy2; /* screen pixel increments */
long delmin; /* for calcfrac/calcmand */
double ddelmin; /* same as a double */
double param[4]; /* up to four parameters */
double potparam[3]; /* three potential parameters*/
long fudge; /* 2**fudgefactor */
long l_at_rad; /* finite attractor radius */
double f_at_rad; /* finite attractor radius */
int bitshift; /* fudgefactor */
int badconfig = 0; /* 'fractint.cfg' ok? */
int diskisactive; /* disk-video drivers flag */
int diskvideo; /* disk-video access flag */
/* note that integer grid is set when integerfractal && !invert; */
/* otherwise the floating point grid is set; never both at once */
long far *lx0, far *ly0; /* x, y grid */
long far *lx1, far *ly1; /* adjustment for rotate */
/* note that lx1 & ly1 values can overflow into sign bit; since */
/* they're used only to add to lx0/ly0, 2s comp straightens it out */
double far *dx0, far *dy0; /* floating pt equivs */
double far *dx1, far *dy1;
int integerfractal; /* TRUE if fractal uses integer math */
/* usr_xxx is what the user wants, vs what we may be forced to do */
char usr_stdcalcmode;
int usr_periodicitycheck;
int usr_distest;
char usr_floatflag;
int viewwindow; /* 0 for full screen, 1 for window */
float viewreduction; /* window auto-sizing */
int viewcrop; /* nonzero to crop default coords */
float finalaspectratio; /* for view shape and rotation */
int viewxdots,viewydots; /* explicit view sizing */
extern int inside; /* inside color: 1=blue */
extern int outside; /* outside color, if set */
extern int cyclelimit; /* color-rotator upper limit */
extern int display3d; /* 3D display flag: 0 = OFF */
extern int overlay3d; /* 3D overlay flag: 0 = OFF */
extern int boxcolor; /* zoom box color */
extern int color_bright; /* set by find_special_colors */
#ifndef XFRACT
extern BYTE dacbox[256][3]; /* Video-DAC (filled in by SETVIDEO) */
extern BYTE olddacbox[256][3]; /* backup copy of the Video-DAC */
#else
BYTE dacbox[256][3]; /* Video-DAC (filled in by SETVIDEO) */
BYTE olddacbox[256][3]; /* backup copy of the Video-DAC */
#endif
extern struct videoinfo far videotable[];
extern BYTE far *mapdacbox; /* default dacbox when map= specified */
extern int daclearn, daccount; /* used by the color-cyclers */
extern int extraseg; /* used by Save-to-DISK routines */
extern int cpu; /* cpu type */
extern int fpu; /* fpu type */
extern int iit; /* iit fpu? */
extern int lookatmouse; /* used to select mouse mode */
extern int (*outln)(BYTE *, int); /* called in decoder */
void (*outln_cleanup)();
extern int filetype; /* GIF or other */
/* variables defined by the command line/files processor */
extern double inversion[];
extern int invert; /* non-zero if inversion active */
extern int initbatch; /* 1 if batch run (no kbd) */
extern int initmode; /* initial video mode */
extern int goodmode; /* video.asm sets nonzero if mode ok */
extern int initcyclelimit; /* initial cycle limit */
extern int LogFlag; /* non-zero if logarithmic palettes */
extern int reallyega; /* == 0 if it's really an EGA */
extern char showbox; /* flag to show box and vector in preview */
extern unsigned initsavetime; /* timed save interval */
int comparegif=0; /* compare two gif files flag */
int timedsave=0; /* when doing a timed save */
extern long saveticks, savebase; /* timed save vars for general.asm */
extern int finishrow; /* for general.asm timed save */
int resave_flag=0; /* tells encoder not to incr filename */
int started_resaves=0; /* but incr on first resave */
int save_release,save_system; /* from and for save files */
int tabmode = 1; /* tab display enabled */
extern int release; /* real current Fractint release */
extern int got_status;
extern int loaded3d;
extern int colorstate,colorpreloaded; /* comments in cmdfiles */
extern int functionpreloaded; /* set in cmdfiles for old bifs JCO 7/5/92 */
#ifdef XFRACT
char **__argv;
extern int XZoomWaiting;
#endif
/* for historical reasons (before rotation): */
/* top left corner of screen is (xxmin,yymax) */
/* bottom left corner of screen is (xx3rd,yy3rd) */
/* bottom right corner of screen is (xxmax,yymin) */
double xxmin,xxmax,yymin,yymax,xx3rd,yy3rd; /* selected screen corners */
long xmin, xmax, ymin, ymax, x3rd, y3rd; /* integer equivs */
double sxmin,sxmax,symin,symax,sx3rd,sy3rd; /* displayed screen corners */
double plotmx1,plotmx2,plotmy1,plotmy2; /* real->sc